package com.jshan.blog.utils;

import java.util.Random;

/**
 * 生成随机验证码的方法
 */
public class RandomCode {

    public static String getRandomCode(int length) {
        Random random = new Random();
        StringBuffer sb = new StringBuffer();
        for (int i = 0; i < length; i++) {
            sb.append(random.nextInt(10));
        }
        return sb.toString();
    }

}
